home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form ViewportForm
- Caption = "Viewport"
- ClientHeight = 2910
- ClientLeft = 2550
- ClientTop = 1800
- ClientWidth = 2910
- Height = 3600
- Left = 2490
- LinkTopic = "Form1"
- ScaleHeight = 2910
- ScaleWidth = 2910
- Top = 1170
- Width = 3030
- Begin VB.PictureBox viewport
- Height = 2895
- Left = 0
- ScaleHeight = 2835
- ScaleWidth = 2835
- TabIndex = 0
- Top = 0
- Width = 2895
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- Attribute VB_Name = "ViewportForm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- ' ************************************************
- ' Draw a smiley face in the viewport centered
- ' around the point (5, 5).
- ' ************************************************
- Sub DrawSmiley()
- Const pi = 3.14159265
- Const pi2 = 2 * pi
- Viewport.Circle (5, 5), 4 ' Head
- Viewport.Circle (5, 5), 3, , pi, pi2 ' Smile
- Viewport.Circle (3, 7), 0.75 ' Left eye.
- Viewport.Circle (7, 7), 0.75 ' Right eye.
- Viewport.Circle (5, 5), 0.75 ' Nose.
- End Sub
- Private Sub Form_Load()
- Dim x As Single
- Dim y As Single
- Dim wid As Single
- Dim hgt As Single
- ' Make the viewport 2 inches square.
- x = Viewport.Left
- y = Viewport.Top
- wid = 2 * 1440 + Viewport.Width - Viewport.ScaleWidth
- hgt = 2 * 1440 + Viewport.Height - Viewport.ScaleHeight
- Viewport.Move x, y, wid, hgt
- ' Attach the world window.
- Viewport.Scale (0, 10)-(10, 0)
- End Sub
- Private Sub Form_Resize()
- Viewport.Move 0, 0, ScaleWidth, ScaleHeight
- End Sub
- Private Sub mnuFileExit_Click()
- Unload Me
- End Sub
- Private Sub Viewport_Paint()
- DrawSmiley
- End Sub
-